﻿using System;
using System.Reflection;

using TypeConverter = System.ComponentModel.TypeConverter;

namespace Sencha.Serialization.Contracts
{
	public abstract class MetadataDescriber
	{
		public static readonly MetadataDescriber ReflectionPublicOnly = new ReflectionMetadataDescriber { IncludePrivateMembers = false };
		public static readonly MetadataDescriber ReflectionPublicAndPrivate = new ReflectionMetadataDescriber { IncludePrivateMembers = true };
		public static readonly MetadataDescriber Default = new ReflectionMetadataDescriber { IncludePrivateMembers = ReflectionExtentions.IsReflectionPermissionGranted() };

		public abstract MemberInfo[] GetMembers(Type contractedType);

		public abstract Attribute[] GetAttributes(MemberInfo metadataMember);
		public abstract string GetName(MemberInfo metadataMember);

		public abstract Type GetMemberType(MemberInfo metadataMember);
		public abstract TypeConverter GetMemberConverter(MemberInfo metadataMember);
		public abstract bool IsMemberReadOnly(MemberInfo metadataMember);
		public abstract Type GetDeclaringType(MemberInfo metadataMember);
		public abstract MemberAccessModifiers GetMemberAccessModifiers(MemberInfo metadataMember);
	}
}
